<div>
    <h2 id="page-heading">
        <span jhiTranslate="jhipsterSampleApplicationApp.operation.home.title">Operations</span>

        <button [routerLink]="['/operation/new']" class="btn btn-primary float-right jh-create-entity create-operation"
                id="jh-create-entity">
            <fa-icon icon="plus"></fa-icon>
            <span jhiTranslate="jhipsterSampleApplicationApp.operation.home.createLabel">
            Create a new Operation
            </span>
        </button>
    </h2>

    <jhi-alert-error></jhi-alert-error>

    <jhi-alert></jhi-alert>

    <div *ngIf="operations?.length === 0" class="alert alert-warning" id="no-result">
        <span jhiTranslate="jhipsterSampleApplicationApp.operation.home.notFound">No operations found</span>
    </div>

    <div *ngIf="operations && operations.length > 0" class="table-responsive" id="entities">
        <table aria-describedby="page-heading" class="table table-striped">
            <thead>
            <tr [(ascending)]="ascending" [(predicate)]="predicate" [callback]="reset.bind(this)" jhiSort>
                <th jhiSortBy="id" scope="col"><span jhiTranslate="global.field.id">ID</span>
                    <fa-icon icon="sort"></fa-icon>
                </th>
                <th jhiSortBy="date" scope="col"><span
                        jhiTranslate="jhipsterSampleApplicationApp.operation.date">Date</span>
                    <fa-icon icon="sort"></fa-icon>
                </th>
                <th jhiSortBy="description" scope="col"><span
                        jhiTranslate="jhipsterSampleApplicationApp.operation.description">Description</span>
                    <fa-icon icon="sort"></fa-icon>
                </th>
                <th jhiSortBy="amount" scope="col"><span jhiTranslate="jhipsterSampleApplicationApp.operation.amount">Amount</span>
                    <fa-icon icon="sort"></fa-icon>
                </th>
                <th jhiSortBy="bankAccount.name" scope="col"><span
                        jhiTranslate="jhipsterSampleApplicationApp.operation.bankAccount">Bank Account</span>
                    <fa-icon icon="sort"></fa-icon>
                </th>
                <th scope="col"></th>
            </tr>
            </thead>
            <tbody (scrolled)="loadPage(page + 1)" [infiniteScrollDisabled]="page >= links['last']"
                   [infiniteScrollDistance]="0" infinite-scroll>
            <tr *ngFor="let operation of operations ;trackBy: trackId">
                <td><a [routerLink]="['/operation', operation.id, 'view']">{{ operation.id }}</a></td>
                <td>{{ operation.date | date:'medium' }}</td>
                <td>{{ operation.description }}</td>
                <td>{{ operation.amount }}</td>
                <td>
                    <div *ngIf="operation.bankAccount">
                        <a [routerLink]="['/bank-account', operation.bankAccount?.id, 'view']">{{
                            operation.bankAccount?.name }}</a>
                    </div>
                </td>
                <td class="text-right">
                    <div class="btn-group">
                        <button [routerLink]="['/operation', operation.id, 'view']"
                                class="btn btn-info btn-sm"
                                type="submit">
                            <fa-icon icon="eye"></fa-icon>
                            <span class="d-none d-md-inline" jhiTranslate="entity.action.view">View</span>
                        </button>

                        <button [routerLink]="['/operation', operation.id, 'edit']"
                                class="btn btn-primary btn-sm"
                                type="submit">
                            <fa-icon icon="pencil-alt"></fa-icon>
                            <span class="d-none d-md-inline" jhiTranslate="entity.action.edit">Edit</span>
                        </button>

                        <button (click)="delete(operation)" class="btn btn-danger btn-sm"
                                type="submit">
                            <fa-icon icon="times"></fa-icon>
                            <span class="d-none d-md-inline" jhiTranslate="entity.action.delete">Delete</span>
                        </button>
                    </div>
                </td>
            </tr>
            </tbody>
        </table>
    </div>
</div>
